import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { StrLevelInfo } from "./info/StrLevelInfo";
type int = number;
//class StrengthenLevelConfig
    
    export  class StrengthenLevelConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (StrengthenLevelConfig._instance != null) 
            {
                throw new Error(" SuitConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("strengthenLevel.xml");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=arg1.items;
            for(loc2 of loc5) 
            {
                loc1 = new StrLevelInfo(loc2.code, loc2.type);
                if (typeof loc2.item === "array") 
                {
                    var loc6=0;
                    var loc7=loc2.item;
                    for(loc3 of loc7) 
                    {
                        this.addMap(loc3, loc1);
                    }
                    continue;
                }
                if (typeof !(loc2.item === "object")) 
                {
                    continue;
                }
                this.addMap(loc2.item, loc1);
            }
            return;
        }

        /* internal  */addMap(arg1: Object, arg2: StrLevelInfo): void
        {
            var loc1=arg1.minLevel;
            while (loc1 <= arg1.maxLevel) 
            {
                this._map[arg2.key + "_" + loc1] = arg1.id;
                ++loc1;
            }
            return;
        }

        public getWeaponStr(arg1: int): string
        {
            return this._map["weapon_1_" + arg1];
        }

        public getWingStr(arg1: int, arg2: int): string
        {
            return this._map["wing_" + arg1 + "_" + arg2];
        }

        public getMountStr(arg1: int): string
        {
            return this._map["mount_2_" + arg1];
        }

        public static get instance(): StrengthenLevelConfig
        {
            if (StrengthenLevelConfig._instance == null) 
            {
                StrengthenLevelConfig._instance = new StrengthenLevelConfig();
            }
            return StrengthenLevelConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: StrengthenLevelConfig;
    }
